require(['config'],()=>{
    require(['jquery','header','footer','floater'],()=>{
        $('#btn').on('click',()=>{
            let user=$('#username')[0].value
            let pass=$('#password')[0].value
            if(!user||!pass){
                alert('请输入账号或密码')
            }else{
                let userData=JSON.parse(localStorage.getItem('key'))
                let res=userData.find(item=>{return item.user==user})
                if(res){
                    if(res.pass==pass){
                        localStorage.setItem('username',JSON.stringify(user))
                        location.href='/index.html'
                    }else{
                        alert('账号或密码错误')
                    }
                }else{
                    alert('账号或密码错误')
                }
            }
        })
    })
})